<template>
    <el-card shadow="never">
        <yun-table
                :columns="columns"
                search="nickname,mobile"
                toolbar="refresh,add,edit,del,import,download,recyclebin,more"
                :auth="{
                    add:{:$auth->check('app\\admin\\controller\\delivery\\Channel','add')},
                    edit:{:$auth->check('app\\admin\\controller\\delivery\\Channel','edit')},
                    del:{:$auth->check('app\\admin\\controller\\delivery\\Channel','del')},
                    multi:{:$auth->check('app\\admin\\controller\\delivery\\Channel','multi')},
                    recyclebin:{:$auth->check('app\\admin\\controller\\delivery\\Channel','recyclebin')},
                }"
                :extend="extend">
        </yun-table>
    </el-card>
</template>
<script>
    import table from "@components/Table.js";
    export default{
        components:{
            'YunTable':table
        },
        data:{
            extend:{
                index_url: 'delivery/channel/index',
                add_url: 'delivery/channel/add',
                edit_url: 'delivery/channel/edit',
                del_url: 'delivery/channel/del',
                multi_url: 'delivery/channel/multi',
                download_url: 'delivery/channel/download',
                recyclebin_url:'delivery/channel/recyclebin'
            },
            columns:[
                {checkbox: true},
                {field:"id",title:"ID",operate:false,width: 80},
                {field:"title",title:"名称"},
                {field:"phone",title:"电话",width: 130},
                {field:"goods",title:"销售商品",width:400,operate:false,formatter:function(data,row){
                    if(!row.goods || row.goods.length==0){
                        return '';
                    }
                    let tags=Yunqi.formatter.tags;
                    tags.value=row.goods.map(function (item){return item.name});
                    return tags;
                }},
                {field:"sub_mch_id",title:"微信商户号",width: 130,operate:false},
                {
                    field:"delivery_endtime",
                    operate:false,
                    title:"配送时间",
                },
                {field:"is_default",title:"自营",formatter:Yunqi.formatter.switch,operate:false,searchList:{"0":"否","1":"是"}},
                {field:"status", width:100,title:"状态",formatter:Yunqi.formatter.switch,operate:"select",searchList:{"normal":"正常","hidden":"隐藏"}},
                {
                    field: 'operate',
                    title: __('操作'),
                    width:100,
                    action:{
                        edit:true,
                        del:true,
                    },
                }
            ]
        }
    }
</script>
<style>

</style>
